﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Web.UI;

namespace Lilium.Web.Mvc.AjaxControlToolkit
{
	[RequiredResource(typeof(CommonToolkitScripts))]
	[RequiredResource(typeof(AnimationExtender))]
	[ToolkitScriptReference("PopupExtender.PopupBehavior.js", LoadOrder = 1)]
	public class PopupExtender: AnimationExtenderControlBase
	{
		public PopupExtender(string elementID)
			: base("AjaxControlToolkit.PopupBehavior", elementID)
		{
		}

		/// <summary>
		/// Position the target with respect to this element
		/// </summary>
		[ExtenderControlProperty]
		//[IDReferenceProperty]
		[RequiredProperty]
		[ClientPropertyName("parentElement")]
		[ElementReference]
		[SuppressMessage("Microsoft.Naming", "CA1706:ShortAcronymsShouldBeUppercase", Justification = "Following ASP.NET AJAX pattern")]
		public string ParentElementID
		{
			get;
			set;
		}

		/// <summary>
		/// X coordinate
		/// </summary>
		[ExtenderControlProperty]
		[ClientPropertyName("x")]
		[DefaultValue(0)]
		[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "X", Justification = "Common term")]
		public int X
		{
			get;
			set;
		}

		/// <summary>
		/// Y coordinate
		/// </summary>
		[ExtenderControlProperty]
		[ClientPropertyName("y")]
		[DefaultValue(0)]
		[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Y", Justification = "Common term")]
		public int Y
		{
			get;
			set;
		}

		/// <summary>
		/// Positioning mode
		/// </summary>
		[ExtenderControlProperty]
		[ClientPropertyName("positioningMode")]
		[DefaultValue(PositioningMode.Absolute)]
		public PositioningMode PositioningMode
		{
			get;
			set;
		}

		// TODO: Does this property exist on the client?
		[ExtenderControlProperty]
		[ClientPropertyName("reparent")]
		[DefaultValue(false)]
		[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Reparent", Justification = "Common term")]
		public bool Reparent
		{
			get;
			set;
		}

		/// <summary>
		/// OnShow animation
		/// </summary>
		[ExtenderControlProperty]
		[ClientPropertyName("onShow")]
		[Browsable(false)]
		[DefaultValue(null)]
		[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
		public Animation OnShow
		{
			get;
			set;
		}

		/// <summary>
		/// OnHide animation
		/// </summary>
		[ExtenderControlProperty]
		[ClientPropertyName("onHide")]
		[Browsable(false)]
		[DefaultValue(null)]
		[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
		public Animation OnHide
		{
			get;
			set;
		}
	}
}